package com.atguigu.tingshu.vo.order;

import com.atguigu.tingshu.common.util.Decimal2Serializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import jakarta.validation.Valid;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotEmpty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;

/**
 * 订单对象
 * @author sun
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OrderInfoVo {
    /**
     * 交易号
     */
    @NotEmpty(message = "交易号不能为空")
    private String tradeNo;
    /**
     * 支付方式：1101-微信 1102-支付宝 1103-账户余额
     */
    @NotEmpty(message = "支付方式不能为空")
    private String payWay;
    /**
     * 付款项目类型: 1001-专辑 1002-声音 1003-vip会员
     */
    @NotEmpty(message = "付款项目类型不能为空")
    private String itemType;

    /**
     * 订单原始金额
     */
    @DecimalMin(value = "0.00", inclusive = false, message = "订单原始金额必须大于0.00")
    @DecimalMax(value = "9999.99", message = "订单原始金额必须小于9999.99")
    @Digits(integer = 4, fraction = 2)
    @JsonSerialize(using = Decimal2Serializer.class)
    private BigDecimal originalAmount;
    /**
     * 减免总金额
     */
    @DecimalMin(value = "0.00", message = "减免总金额必须大于0.00")
    @DecimalMax(value = "9999.99", message = "减免总金额必须小于9999.99")
    @Digits(integer = 4, fraction = 2)
    @JsonSerialize(using = Decimal2Serializer.class)
    private BigDecimal derateAmount;
    /**
     * 订单总金额
     */
    @DecimalMin(value = "0.00", inclusive = false, message = "订单总金额必须大于0.00")
    @DecimalMax(value = "9999.99", message = "订单总金额必须小于9999.99")
    @Digits(integer = 4, fraction = 2)
    @JsonSerialize(using = Decimal2Serializer.class)
    private BigDecimal orderAmount;
    /**
     * 订单明细列表
     */
    @Valid
    @NotEmpty(message = "订单明细列表不能为空")
    private List<OrderDetailVo> orderDetailVoList;
    /**
     * 减免明细列表
     */
    private List<OrderDerateVo> orderDerateVoList;
    /**
     * 时间戳
     */
    private Long timestamp;
    /**
     * 签名
     */
    private String sign;
}